﻿@{
    Layout = "~/Views/Shared/_LayoutEmpty.cshtml";
}
<script src="~/Scripts/jaws-form.js"></script>
<script src="~/Scripts/jaws-input.js"></script>
<div class="regist">
    <div class="header">
        <a href="/">
            <div class="logo">

            </div>
        </a>
        <div class="logoright">
            <a href="@Url.DomainRouteUrl(AreasConfig.Web, "index", "regist")">加入赢在投资»</a>
        </div>
    </div>
    <div class="content">

        <h3>
            账户登录
        </h3>

        <div class="form">
            <div>
                <form mark="StockForm">
                    <div class="item">
                        <input type="text" mark="ShowInput" class="ui-input" value="用户名" />
                        @Html.TextEdit("UserName", "", "", new { Class = "ui-input", style = "display:none", mark = "HideInput" }, new { req = 1, maxlen = 30, minlen = 4}, new { label = "用户名", helper = "4-16位字母、数字、下划线或中文" })
                        <div class="ico-username"></div>
                    </div>
                    <div class="item">
                        <input type="text" mark="ShowInput" class="ui-input" value="密码" />@Html.TextEditPassword("UserPassword", "", new { Class = "ui-input", style = "display:none", mark = "HideInput" }, new { req = 1, maxlen = 30, minlen = 6, reg = "^[0-9|a-z|A-Z]{6,}$" }, new { label = "密码", helper = "6-16位数字和字母组成" })
                        <div class="ico-password"></div>
                    </div>
                    <div class="item" style="padding-bottom: 60px;">
                        <a type="button" id="Next0" tag="button" class="ui-btn" href="javascript:void(0)">登 录</a>
                        <span class="toreg">没有帐号？ <a href="@Url.DomainRouteUrl(AreasConfig.Web, "index", "regist")">免费注册</a></span>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="sbox">
            © 2013-2014 赢在投资 All rights reserved 臣乾金融信息服务（上海）有限公司 <a class="grey1" target="_blank" href="http://www.miibeian.gov.cn/">沪ICP备14012497号</a>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $("input[mark=ShowInput]").bind({
            "focusin.page": function () {
                $(this).hide().next().show().focus();
            }
        });
        $("input[mark=HideInput]").bind({
            "focusout.page": function () {
                var $this = $(this);
                if ($.trim($this.val()) == "") {
                    $this.hide().prev().show();
                }
            }
        });
        var returnUrl = "@(ViewBag.ReturnUrl)";
        window.ButtonClick = function () {
            var user = {};
            var $UserName = $("#UserName");
            var $Password = $("#UserPassword");
            user.userName = $.trim($UserName.val());
            user.passWord = $.trim($Password.val());
            $.jajax({
                url: "@Url.DomainRouteUrl(AreasConfig.Web, "index", "login")",
                params: user,
                callback: function (ret) {
                    if (!ret) {
                        return;
                    }
                    if (ret.code == 1) {
                        if (returnUrl) {
                            window.location.href = returnUrl;
                        } else {
                            window.location.href = "/";
                        }
                    } else {
                        $.jalert(ret.message);
                    }
                }
            });
        };
    });
</script>